import logging
import requests
from api.login_api import Mepsking_Login
from config import Base_Host
class Coupons:
    def get_coupons(self,coupons_id,token):
        url=Base_Host+"/api/meps/couponDistribution/save?couponId={}".format(coupons_id)
        header_dict = {'accessToken': token}
        resp=requests.post(url=url,headers=header_dict)
        logging.info('获取优惠券接口返回的数据为：{}'.format(resp.json()))
        return resp
if __name__ == '__main__':
    resp = Mepsking_Login()
    login_dict={"account": "2524726232@qq.com", "password": "8c730e7f3dac741443cd3a57cdb7fd8f", "sourceFrom": "PC"}
    token=resp.token(login_dict)
    coupons_id='1661917249921261570'
    test=Coupons().get_coupons(coupons_id,token)